// ----------------------------------------------------------------------------
//
// A class that implements an alarm object.
//
// ----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;

namespace WERServices
{
    /// <summary>
    /// A class that implements an alarm object.
    /// </summary>
    public class Alarm
    {
        #region Fields
        private int hours = 1;
        private int minutes = 0;
        private TimeNotation amPM = TimeNotation.AM;
        private Repeat alarmRepeat = Repeat.Never;
        #endregion Fields

        #region Constructors
        /// <summary>
        /// Creates a new Alarm object.
        /// </summary>
        /// <param name="hours">Hours part of the alarm. Value should be between 1 and 12.</param>
        /// <param name="minutes">Minutes part of the alarm. Value should be between 0 and 59.</param>
        /// <param name="ampm">Time notation for the alarm. AM or PM.</param>
        /// <param name="repeat">Repeat functionality for the alarm.</param>
        public Alarm(int hours, int minutes, TimeNotation ampm, Repeat repeat)
        {
            this.Hours = hours;
            this.Minutes = minutes;
            this.amPM = ampm;
            this.alarmRepeat = repeat;
        }
        #endregion Constructors

        #region Properties
        /// <summary>
        /// Gets the hours part of the alarm.
        /// </summary>
        public int Hours
        {
            get { return this.hours; }
            private set
            {
                if (value < 1 || value > 12)
                {
                    throw new ArgumentOutOfRangeException("Hours", "Hours should be between 1 and 12.");
                }
                this.hours = value;
            }
        }

        /// <summary>
        /// Gets the minutes part of the alarm.
        /// </summary>
        public int Minutes
        {
            get { return this.minutes; }
            private set
            {
                if (value < 0 || value > 59)
                {
                    throw new ArgumentOutOfRangeException("Minutes", "Minutes should be between 0 and 59.");
                }
                this.minutes = value;
            }
        }

        /// <summary>
        /// Gets the time notation (AM/PM) part of the alarm.
        /// </summary>
        public TimeNotation AMPM
        {
            get { return this.amPM; }
        }

        /// <summary>
        /// Gets the repeat functionality setting of the alarm.
        /// </summary>
        public Repeat AlarmRepeat
        {
            get { return this.alarmRepeat; }
        }
        #endregion Properties

        #region Enums
        /// <summary>
        /// Enum to represent whether the alarm is in AM or PM.
        /// </summary>
        public enum TimeNotation
        {
            AM
            , PM
        }

        /// <summary>
        /// Enum to represent repitition of the alarm. Only Never is supported now.
        /// </summary>
        public enum Repeat
        {
            Never
        }
        #endregion Enumns
    }
}
